﻿using Microsoft.Extensions.Configuration;
using MiniFox.Configurations;
using MiniFox.Web;

namespace MiniFox.Platform.Applications.Configurations
{
    /// <summary>
    /// 
    /// </summary>
    [Section(ELEMENT_NAME)]
    public class ApiAuthClientConfiguration
    {
        internal const string ELEMENT_NAME = "minifox:apiAuthClient";

        
        const string VERIFY_TOKEN_URL = "/jwt/verify";

        /// <summary>
        /// SSO验证主机，必须设置为应用程序虚拟路径(例如: http://www.xxxxxx.com:8888 ,  http://www.xxxxxx.com:8080/passport , http://passport.xxxxxx.com)
        /// </summary>
        [ConfigurationKeyName("host")]
        public string Host
        {
            get;
            set;
        }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("verifyTokenUrl")]
        public string VerifyTokenUrl
        {
            get;
            set;
        } = VERIFY_TOKEN_URL;
        /// <summary>
        /// 获取完整的刷新token地址, Host + RenewTokenUrl (例如： http://passport.xxxxxx.xxx/OpenApiAuth/VerifyToken)
        /// </summary>
        public string FullVerifyTokenUrl
        {
            get
            {
                string url = this.VerifyTokenUrl;

                url = WebUtil.BuildFullUrl(this.Host, url);
                return url;
            }
        }
        /// <summary>
        /// 获取例外地址集，该地址集中的URL不需要token即可访问
        /// </summary>
        [ConfigurationKeyName("exceptionUrls")]
        public string[] ExceptionUrls
        {
            get;
            set;
        }

    }
}
